<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core">

<ui:composition template="/WEB-INF/template/basicTemplate.xhtml">

	<ui:define name="content">
		<head>
<title>
	<h:outputText value="#{msg.updateQuestions}" />
</title>
		</head>
		<br />
		<f:event listener="#{loginBean.verifyA()}" type="preRenderView"></f:event>

		<h:form id="form1">
			<div align="center">
				<h:panelGrid columns="2" styleClass="inner-table" style="width:20%;">
					<h:panelGrid columns="2" styleClass="inner-table"
						style="width:20%;">
						<h:outputText value="#{msg.question}:" />
						<h:inputText value="#{intrebariBean.intrebariUpd.intrebare}" />

						<h:outputText value="#{msg.type}:" />
						<h:inputText value="#{intrebariBean.intrebariUpd.tip}" />
						<h:commandButton image="/resources/images/check.png"
							action="#{intrebariBean.update()}" />
					</h:panelGrid>
					
					<h:dataTable value="#{intrebariBean.raspunsuri}" var="item">
						<h:column>
							<f:facet name="header">
								<h:outputText value="#{msg.answer}" />
							</f:facet>
							<h:outputText value="#{item.raspuns}" />
						</h:column>
						<h:column>
							<f:facet name="header">
								<h:outputText value=" " />
							</f:facet>
							<h:commandButton value="#{msg.update}" 
							/>
						</h:column>
						<h:column>
							<f:facet name="header">
								<h:outputText value="#{msg.delete}" />
							</f:facet>
							<h:commandButton image="/resources/images/cross.png" 
							action="#{raspunsBean.delete(item)}"/>
						</h:column>

					</h:dataTable>

				</h:panelGrid>
				</div>
				<div align="center">
					<h2></h2>
					<br />
					<h:commandButton value="#{msg.addAnswer}" styleClass="button"
						action="#{intrebariBean.addInt(intrebariBean.intrebariUpd)}" />
					<h:outputText value=" " />
					
					<br></br>
					<h:commandButton value="#{msg.back}" styleClass="button"
						action="chestionareUpdate" />
					<br></br>
					<h:commandButton value="#{msg.logout}" styleClass="button"
						action="#{adminBean.logOut()}" immediate="true" />
					<br></br>
			</div>

		</h:form>

	</ui:define>

</ui:composition>





</html>